/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.smarttmt.smartmanager.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author nicolas
 */
@Entity
@Table(name = "CAUSREQU")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Causrequ.findAll", query = "SELECT c FROM Causrequ c"),
    @NamedQuery(name = "Causrequ.findByCarecodi", query = "SELECT c FROM Causrequ c WHERE c.carecodi = :carecodi"),
    @NamedQuery(name = "Causrequ.findByCaredesc", query = "SELECT c FROM Causrequ c WHERE c.caredesc = :caredesc"),
    @NamedQuery(name = "Causrequ.findByCareclre", query = "SELECT c FROM Causrequ c WHERE c.careclre = :careclre"),
    @NamedQuery(name = "Causrequ.findByCarevweb", query = "SELECT c FROM Causrequ c WHERE c.carevweb = :carevweb")})
public class Causrequ implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "CARECODI")
    private String carecodi;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "CAREDESC")
    private String caredesc;
    @Size(max = 2)
    @Column(name = "CARECLRE")
    private String careclre;
    @Column(name = "CAREVWEB")
    private BigInteger carevweb;
    @OneToMany(mappedBy = "solucade", fetch = FetchType.LAZY)
    private List<Solucion> solucionList;

    public Causrequ() {
    }

    public Causrequ(String carecodi) {
        this.carecodi = carecodi;
    }

    public Causrequ(String carecodi, String caredesc) {
        this.carecodi = carecodi;
        this.caredesc = caredesc;
    }

    public String getCarecodi() {
        return carecodi;
    }

    public void setCarecodi(String carecodi) {
        this.carecodi = carecodi;
    }

    public String getCaredesc() {
        return caredesc;
    }

    public void setCaredesc(String caredesc) {
        this.caredesc = caredesc;
    }

    public String getCareclre() {
        return careclre;
    }

    public void setCareclre(String careclre) {
        this.careclre = careclre;
    }

    public BigInteger getCarevweb() {
        return carevweb;
    }

    public void setCarevweb(BigInteger carevweb) {
        this.carevweb = carevweb;
    }

    @XmlTransient
    public List<Solucion> getSolucionList() {
        return solucionList;
    }

    public void setSolucionList(List<Solucion> solucionList) {
        this.solucionList = solucionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (carecodi != null ? carecodi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Causrequ)) {
            return false;
        }
        Causrequ other = (Causrequ) object;
        if ((this.carecodi == null && other.carecodi != null) || (this.carecodi != null && !this.carecodi.equals(other.carecodi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.smarttmt.smartmanager.entity.Causrequ[ carecodi=" + carecodi + " ]";
    }
    
}
